package com.sharedlease.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

//@Configuration
//@EnableSwagger2
//public class SwaggerConfig {
//    @Bean
//    public Docket createRestApi() {
//        return new Docket(DocumentationType.SWAGGER_2)
//                .pathMapping("/")
//                .select()
//                .apis(RequestHandlerSelectors.basePackage("com.sharedlease.controller"))
//                .paths(PathSelectors.any())
//                .build().apiInfo(new ApiInfoBuilder()
//                        .title("共享租赁前后端开发接口")
//                        .description("初稿")
//                        .version("1.0")
////                        .contact(new Contact("联系名","blog.csdn.net","1614518467@qq.com"))
////                        .license("The Apache License")
////                        .licenseUrl("http://www.baidu.com")
//                        .build());
//    }
//}
@Configuration
@EnableSwagger2WebMvc
public class SwaggerConfig {

    @Bean(value = "defaultApi2")
    public Docket defaultApi2() {
        Docket docket=new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("智能化共享租赁平台前后端开发接口")
                        .description("初稿")
                        .contact("1614518467@qq.com")
                        .version("1.0")
                        .build())
                //分组名称
                .groupName("初稿")
                .select()
                //这里指定Controller扫描包路径
                .apis(RequestHandlerSelectors.basePackage("com.sharedlease.controller"))
                .paths(PathSelectors.any())
                .build();
        return docket;
    }

}